<?php
/*
 *  Maniter: A webbased business managment tool.
 *  Copyright (C) 2007  Dimitri Michaux <dimitri.michaux@gmail.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * lib-common.php, Maniter
 * 
 * This file has to be included inorder to make Maniter work.
 * It makes a couple of includes and defines some necessary constants.
 *
 * @author Dimitri Michaux
 * @version 0.1
 * @package maniter_core
 */

/**
 * There are some problems with magic_quotes_gprc
 * So, we try to turn it of, if that doesn't work
 * we must fix the problem by doing stripslashes
 * on every array item from: get, post & cookie
 */
ini_set( 'magic_quotes_gprc', 0 );
set_magic_quotes_runtime(0);

if( get_magic_quotes_gpc() == 1 ){
	stripslashesRecursive($_POST);
	stripslashesRecursive($_GET);
	stripslashesRecursive($_COOKIE);
}

//the full path to jiba
define( '_PATH_TO_JIBA', '/var/www/maniter/jiba/' );

//settings
define( 'order_offset', 9 );
define( 'company_logo', '/var/www/maniter/images/logo.jpg');

//timer
include_once( _PATH_TO_JIBA.'timer.class.php');
$timer = new Timer();

define( '_DB_USER', 'maniter' );          //MySQL server username
define( '_DB_PASS', 'vu,2,M7t58JZ5GUy' ); //MySQL server password
define( '_DB_NAME', 'maniter' );          //MySQL database name
define( '_DB_HOST', 'localhost' );        //MySQL server host

//template engine
require_once( 'classes/templateengine.class.php' );
$tpl = new TemplateEngine();
$tpl->addJavaScript( 'java/tabber.js' );

require_once( 'classes/purchaseorder.class.php' );
require_once( 'classes/purchaseoffer.class.php' );

/**
 * Preforms stripslashes on an array recursively
 * 
 * Uses refrences, so no return value
 *
 * @param mixed|array $data
 */
function &stripslashesRecursive( &$data ){
	foreach( $data as &$val ){
		if( is_array($val) )	//if array call function recursively
			stripslashesRecursive($val);
		else
			$val = stripslashes($val);
	}
}
?>